export const objToBase64 = (obj) => {
  const jsonStr = JSON.stringify(obj);
  // Use browser's btoa() function for base64 encoding
  return btoa(unescape(encodeURIComponent(jsonStr)));
};

export const base64ToObj = (base64) => {
  // Use browser's atob() function for base64 decoding
  const decodedString = decodeURIComponent(escape(atob(base64)));
  return JSON.parse(decodedString);
};
